/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdminPage.java
 *
 * Created on 07 14, 12, 3:32:15 PM
 */
package malateproject;

import javax.swing.JOptionPane;

/**
 *
 * @author Aeron
 */
public class AdminPage extends javax.swing.JFrame {

    /** Creates new form AdminPage */
    public AdminPage() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButtonRemove = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListMembers = new javax.swing.JList();
        jButtonRemindStaff = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaCreateAnn = new javax.swing.JTextArea();
        jScrollPane3 = new javax.swing.JScrollPane();
        jListAnn = new javax.swing.JList();
        jButtonPostAnn = new javax.swing.JButton();
        jButtonEditAnn = new javax.swing.JButton();
        jButtonEnDis = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Members");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(470, 40, 80, 20);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Administrator Page");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(230, 10, 180, 40);

        jButtonRemove.setText("Remove Fees");
        jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemoveActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRemove);
        jButtonRemove.setBounds(460, 290, 120, 23);

        jListMembers.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jListMembers);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(440, 70, 150, 180);

        jButtonRemindStaff.setText("Remind Staffer");
        jButtonRemindStaff.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemindStaffActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRemindStaff);
        jButtonRemindStaff.setBounds(460, 320, 120, 23);

        jButton3.setText("Register B. Book");
        getContentPane().add(jButton3);
        jButton3.setBounds(460, 350, 120, 23);

        jTextAreaCreateAnn.setColumns(20);
        jTextAreaCreateAnn.setRows(5);
        jScrollPane2.setViewportView(jTextAreaCreateAnn);

        getContentPane().add(jScrollPane2);
        jScrollPane2.setBounds(220, 80, 190, 210);

        jListAnn.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane3.setViewportView(jListAnn);

        getContentPane().add(jScrollPane3);
        jScrollPane3.setBounds(60, 80, 130, 300);

        jButtonPostAnn.setText("Post Announcement");
        jButtonPostAnn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPostAnnActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonPostAnn);
        jButtonPostAnn.setBounds(250, 310, 130, 23);

        jButtonEditAnn.setText("Edit Announcment");
        jButtonEditAnn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEditAnnActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonEditAnn);
        jButtonEditAnn.setBounds(250, 350, 130, 23);

        jButtonEnDis.setText("Enable/Disable");
        jButtonEnDis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEnDisActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonEnDis);
        jButtonEnDis.setBounds(460, 260, 120, 23);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Announcements");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(70, 50, 120, 30);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MalateBG.E-res.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 620, 410);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoveActionPerformed
            // TODO add your handling code here:
        if(jListMembers.getSelectedValue().equals(null))
            JOptionPane.showMessageDialog(null, "No current selection");
        else
        {
        //database part of removing fees
            //walang naka indicate sa test case JOptionPane.showMessageDialog(null, );
        }
        
    }//GEN-LAST:event_jButtonRemoveActionPerformed

    private void jButtonEnDisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEnDisActionPerformed
        // TODO add your handling code here:
         if(jListMembers.getSelectedValue().equals(null))
            JOptionPane.showMessageDialog(null, "No current selection");
         else
         {
          //database for enable or disable
             // pano gagamitin isang button for disable / enable
         }
    }//GEN-LAST:event_jButtonEnDisActionPerformed

    private void jButtonPostAnnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPostAnnActionPerformed
        // TODO add your handling code here:
        if(jTextAreaCreateAnn.toString().isEmpty())
            JOptionPane.showMessageDialog(null, "Please key in the announcement");
        else
        {
            //add to announcement list
             int pos = jListAnn.getModel().getSize();
            jListAnn.add(this, jTextAreaCreateAnn.getText(), pos);
        }
        
    }//GEN-LAST:event_jButtonPostAnnActionPerformed

    private void jButtonEditAnnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditAnnActionPerformed
        // TODO add your handling code here:
        
        if(jListAnn.getSelectedValue().equals(null))
            JOptionPane.showMessageDialog(null, "No current selection");
        else
        {
            //database part of edit
            // san nya eedit? 
            JOptionPane.showMessageDialog(null, "Announcement updated");
        }
    }//GEN-LAST:event_jButtonEditAnnActionPerformed

    private void jButtonRemindStaffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemindStaffActionPerformed
        // TODO add your handling code here:
        if(jListMembers.getSelectedValue().equals(null))
            JOptionPane.showMessageDialog(null, "No current selection");
        else
        {
           String str = JOptionPane.showInputDialog(null, "Enter Reminder: ", "", 1);
           // add str to reminder of selected member
           //ddatabase part
        }
    }//GEN-LAST:event_jButtonRemindStaffActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AdminPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AdminPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AdminPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AdminPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new AdminPage().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButtonEditAnn;
    private javax.swing.JButton jButtonEnDis;
    private javax.swing.JButton jButtonPostAnn;
    private javax.swing.JButton jButtonRemindStaff;
    private javax.swing.JButton jButtonRemove;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JList jListAnn;
    private javax.swing.JList jListMembers;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea jTextAreaCreateAnn;
    // End of variables declaration//GEN-END:variables
}
